<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="权利人编号" prop="obligeeId">
        <el-input
          v-model="queryParams.obligeeId"
          placeholder="请输入权利人编号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="权利人类型" prop="obligeeType">
        <el-input
          v-model="queryParams.obligeeType"
          placeholder="请输入权利人类型"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="合同上的权利人名称(当地语言)" prop="obligeeNameContractLocal">
        <el-input
          v-model="queryParams.obligeeNameContractLocal"
          placeholder="请输入合同上的权利人名称(当地语言)"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['system:obligee:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['system:obligee:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['system:obligee:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['system:obligee:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="obligeeList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="序号" align="center" prop="id" />
      <el-table-column label="权利人编号" align="center" prop="obligeeId" />
      <el-table-column label="权利人类型" align="center" prop="obligeeType" />
      <el-table-column label="合同上的权利人名称(当地语言)" align="center" prop="obligeeNameContractLocal" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['system:obligee:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['system:obligee:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改权利人对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="50%" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="180px">
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="直往权利人" prop="isRightHolder">
              <el-radio-group v-model="form.isRightHolder">
                <el-radio :label="1">是</el-radio>
                <el-radio :label="0">否</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="常用代理店" prop="frequentAgencyShop">
              <el-select v-model="form.frequentAgencyShop" placeholder="请选择" style="width: 100%">
                <el-option
                  v-for="item in frequentAgencyShopList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="权利人编号" prop="obligeeId">
              <el-input v-model="form.obligeeId" placeholder="请输入权利人编号" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="权利人类型" prop="obligeeType">
              <el-select v-model="form.obligeeType" placeholder="请选择" style="width: 100%">
                <el-option
                  v-for="item in obligeeTypeList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="送审是否附上封面翻译" prop="review">
              <el-radio-group v-model="form.review">
                <el-radio :label="1">是</el-radio>
                <el-radio :label="0">否</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="权利人名(当地语言)" prop="obligeeNameLocal">
              <el-input v-model="form.obligeeNameLocal" placeholder="请输入权利人名(当地语言)" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="权利人名(英文)" prop="obligeeNameEng">
              <el-input v-model="form.obligeeNameEng" placeholder="请输入权利人名(英文)" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="联络地址1(当地语言)" prop="addressLocal">
              <el-input v-model="form.addressLocal" placeholder="请输入联络地址1(当地语言)" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="联络地址1(英文)" prop="addressEng">
              <el-input v-model="form.addressEng" placeholder="请输入联络地址1(英文)" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="联络地址2(当地语言)" prop="addressLocal2">
              <el-input v-model="form.addressLocal2" placeholder="请输入联络地址2(当地语言)" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="联络地址2(英文)" prop="addressEng2">
              <el-input v-model="form.addressEng2" placeholder="请输入联络地址2(英文)" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="合同上的权利人名称(当地语言)" label-width="230px" prop="obligeeNameContractLocal">
              <el-input v-model="form.obligeeNameContractLocal" placeholder="请输入合同上的权利人名称(当地语言)" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="合同上的权利人名称(英语)" prop="obligeeNameContractEng">
              <el-input v-model="form.obligeeNameContractEng" placeholder="请输入合同上的权利人名称(英语)" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="合同上地址(当地语言)" prop="addressContractLocal">
              <el-input v-model="form.addressContractLocal" placeholder="请输入合同上地址(当地语言)" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="合同上地址(英语)" prop="addressContractEng">
              <el-input v-model="form.addressContractEng" placeholder="请输入合同上地址(英语)" />
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <div class="small_title">
              <div class="blur_point"></div>
              <span>公司信息</span>
            </div>
          </el-col>
          <el-col :span="12">
            <el-form-item label="公司负责人名称(当地语言)" prop="companyPersonChinese">
              <el-input v-model="form.companyPersonChinese" placeholder="请输入公司负责人名称(当地语言)" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="公司负责人名称(英文)" prop="companyPersonEng">
              <el-input v-model="form.companyPersonEng" placeholder="请输入公司负责人名称(英文)" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="签字代表1(当地语言)" prop="signatoryNameChinese">
              <el-input v-model="form.signatoryNameChinese" placeholder="请输入签字代表1(当地语言)" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="签字代表1(英文)" prop="signatoryNameEng">
              <el-input v-model="form.signatoryNameEng" placeholder="请输入签字代表1(英文)" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="签字代表2(当地语言)" prop="signatoryNameChinese2">
              <el-input v-model="form.signatoryNameChinese2" placeholder="请输入签字代表2(当地语言)" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="签字代表2(英文)" prop="signatoryNameEng2">
              <el-input v-model="form.signatoryNameEng2" placeholder="请输入签字代表2(英文)" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="签字代表3(当地语言)" prop="signatoryNameChinese3">
              <el-input v-model="form.signatoryNameChinese3" placeholder="请输入签字代表3(当地语言)" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="签字代表3(英文)" prop="signatoryNameEng3">
              <el-input v-model="form.signatoryNameEng3" placeholder="请输入签字代表3(英文)" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="签字代表职称(当地语言)" prop="signatoryPositionChinese">
              <el-input v-model="form.signatoryPositionChinese" placeholder="请输入签字代表职称(当地语言)" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="签字代表职称(英文)" prop="signatoryPositionEng">
              <el-input v-model="form.signatoryPositionEng" placeholder="请输入签字代表职称(英文)" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="公司电话" prop="companyPhone">
              <el-input v-model="form.companyPhone" placeholder="请输入公司电话" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="公司传真" prop="companyFax">
              <el-input v-model="form.companyFax" placeholder="请输入公司传真" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="公司电邮" prop="companyEmail">
              <el-input v-model="form.companyEmail" placeholder="请输入公司电邮" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="公司官网" prop="companyOfficialWebsite">
              <el-input v-model="form.companyOfficialWebsite" placeholder="请输入公司官网" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="签约代表姓名/职称/电邮" prop="companyOfficialWebsite">
              <el-input v-model="form.companyOfficialWebsite" placeholder="请输入签约代表姓名/职称/电邮" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="窗口姓名/职称/电邮" prop="companyOfficialWebsite">
              <el-input v-model="form.companyOfficialWebsite" placeholder="请输入窗口姓名/职称/电邮" />
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <div class="small_title">
              <div class="blur_point"></div>
              <span>签约方式</span>
            </div>
          </el-col>
          <el-col :span="24">
            <el-form-item label="签约方式" prop="signWay">
              <el-checkbox-group v-model="form.signWay" placeholder="请选择签约方式">
                <el-checkbox label="电子签约"></el-checkbox>
                <el-checkbox label="纸本"></el-checkbox>
                <el-checkbox label="PDF"></el-checkbox>
              </el-checkbox-group>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="发行者" prop="publisher">
              <el-checkbox-group v-model="form.publisher" placeholder="请选择发行者">
                <el-checkbox label="权利人发行"></el-checkbox>
                <el-checkbox label="代理店发行"></el-checkbox>
                <el-checkbox label="出版社发行"></el-checkbox>
              </el-checkbox-group>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="电子签约种类" prop="contractTyoeOnline">
              <el-checkbox-group v-model="form.contractTyoeOnline" placeholder="请选择发行者">
                <el-checkbox label="AdobeSign"></el-checkbox>
                <el-checkbox label="DocuSign"></el-checkbox>
                <el-checkbox label="其他"></el-checkbox>
              </el-checkbox-group>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            电子签约邮件寄送：
          </el-col>
          <el-col :span="12">
            <el-form-item label="To" prop="toType" label-width="100px">
              <el-select v-model="form.toType" placeholder="请选择">
                <el-option
                  v-for="item in toTypeList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="CC" prop="ccType" label-width="100px">
              <el-select v-model="form.ccType" placeholder="请选择">
                <el-option
                  v-for="item in ccTypeList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
              <!-- <el-input v-model="form.obligeeType" placeholder="请输入权利人类型" /> -->
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <div class="small_title">
              <div class="blur_point"></div>
              <span>事业部名称/业务负责人</span>
            </div>
          </el-col>
          <div v-for="(i, index) in form.chargePersonCauseList" :key="index">
            <el-col :span="8">
              <el-form-item :label="'部门名称' + (index + 1)" label-width="100">
                <el-input v-model="i.section" :placeholder="'请输入部门名称' + (index + 1)" />
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item :label="'业务负责人' + (index + 1)" label-width="100">
                <div style="display:flex;width: 100%;">
                  <el-input style="width: 50% !important;" v-model="i.chargePersonName" :placeholder="'业务负责人名称1'" />
                  <el-input style="width: 50% !important;margin-left: 5px" v-model="i.chargePersonName2" :placeholder="'业务负责人名称2'" />
                </div>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item :label="'电邮' + (index + 1)" label-width="100">
                <div style="display: flex;width: 100%;">
                  <el-input style="width: 50% !important;" v-model="i.email" :placeholder="'请输入电邮1'" />
                  <el-input style="width: 50% !important;margin-left: 5px" v-model="i.email2" :placeholder="'请输入电邮2'" />
                </div>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item :label="'电话号码' + (index + 1)" label-width="100">
                <el-input v-model="i.phone" :placeholder="'请输入电话号码' + (index + 1)" />
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item :label="'手机号码' + (index + 1)" label-width="100">
                <el-input v-model="i.mobilePhone" :placeholder="'请输入手机号码' + (index + 1)" />
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item :label="'SNS' + (index + 1)" label-width="100">
                <el-input v-model="i.sns" :placeholder="'请输入SNS' + (index + 1)" />
              </el-form-item>
            </el-col>
          </div>
          
          <el-col :span="24">
            <div class="small_title">
              <div class="blur_point"></div>
              <span>会计负责人</span>
            </div>
          </el-col>
          <div v-for="(i, index) in form.chargePersonAccountantList" :key="index">
            <el-col :span="6">
              <el-form-item :label="'部门名称' + (index + 1)" label-width="100">
                <el-input v-model="i.section" :placeholder="'请输入部门名称' + (index + 1)" />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item :label="'会计负责人' + (index + 1)" label-width="100">
                <el-input v-model="i.chargePersonName" :placeholder="'请输入会计负责人' + (index + 1)" />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item :label="'电邮' + (index + 1)" label-width="100">
                <el-input v-model="i.email" :placeholder="'请输入电邮' + (index + 1)" />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item :label="'电话号码' + (index + 1)" label-width="100">
                <el-input v-model="i.phone" :placeholder="'请输入电话号码' + (index + 1)" />
              </el-form-item>
            </el-col>
          </div>
          <el-col :span="24">
            <div class="small_title">
              <div class="blur_point"></div>
              <span>银行信息</span>
            </div>
          </el-col>
          <el-col :span="12">
            <el-form-item label="银行名称(当地名称)" prop="bankNameLocal">
              <el-input v-model="form.bankNameLocal" placeholder="请输入银行名称(当地名称)" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="银行支行名称(当地名称)" prop="bankBranchNameLocal">
              <el-input v-model="form.bankBranchNameLocal" placeholder="请输入银行支行名称(当地名称)" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="银行名称(英文)" prop="bankNameEng">
              <el-input v-model="form.bankNameEng" placeholder="请输入银行名称(英文)" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="银行支行名称(英文)" prop="bankBranchNameEng">
              <el-input v-model="form.bankBranchNameEng" placeholder="请输入银行支行名称(英文)" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="银行地址(当地)" prop="bankAddressLocal">
              <el-input v-model="form.bankAddressLocal" placeholder="请输入银行地址(当地)" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="银行地址(英文)" prop="bankAddressEng">
              <el-input v-model="form.bankAddressEng" placeholder="请输入银行地址(英文)" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="银行账户名称(当地)" prop="bankAccountNameLocal">
              <el-input v-model="form.bankAccountNameLocal" placeholder="请输入银行账户名称(当地)" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="银行账户名称(英文)" prop="bankAccountNameEng">
              <el-input v-model="form.bankAccountNameEng" placeholder="请输入银行账户名称(英文)" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="银行账户号码" prop="bankAccountNumber">
              <el-input v-model="form.bankAccountNumber" placeholder="请输入银行账户号码" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="SWIFT CODE" prop="swiftCode">
              <el-input v-model="form.swiftCode" placeholder="请输入SWIFT CODE" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="银行手续费" prop="bankServiceCharge">
              <el-radio-group v-model="form.bankServiceCharge">
                <el-radio :label="0">不要</el-radio>
                <el-radio :label="1">要</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="银行手续费金额" prop="bankServiceChargeAmount">
              <div style="display: flex">
                <el-select v-model="form.monetaryUnit" placeholder="请选择">
                  <el-option
                    v-for="item in monetaryUnitList"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value">
                  </el-option>
                </el-select>
                <el-input v-model="form.bankServiceChargeAmount" style="margin-left: 10px" placeholder="请输入金额" />
              </div>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="完税证明" prop="dutyPaidProof">
              <el-radio-group v-model="form.dutyPaidProof" @change="dutyPaidProofChange">
                <el-radio :label="0">不要</el-radio>
                <el-radio :label="1">要</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <div class="small_title">
              <div class="blur_point"></div>
              <span>发票相关</span>
            </div>
          </el-col>
          <el-col :span="12">
            <el-form-item label="发票的公司名" prop="invoiceCompanyName">
              <el-input v-model="form.invoiceCompanyName" placeholder="请输入发票的公司名" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="统一发票号码/纳税人识别号" label-width="220px" prop="invoiceNumber">
              <el-input v-model="form.invoiceNumber" placeholder="请输入同一发票号码/纳税人识别号" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="地址/电话" prop="invoicePhone">
              <el-input v-model="form.invoicePhone" placeholder="请输入地址/电话" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="开户行及账号" prop="bankDeposit">
              <el-input v-model="form.bankDeposit" placeholder="请输入开户行及账号" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="开票时间" prop="invoiceTime">
              <el-radio-group v-model="form.invoiceTime">
                <el-radio :label="1">权利人收款前</el-radio>
                <el-radio :label="2">权利人收款后</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="开票种类" prop="invoiceType">
              <el-radio-group v-model="form.invoiceType">
                <el-radio :label="1">普通发票</el-radio>
                <el-radio :label="2">专用发票</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="发票增值税" prop="invoiceAddedTax">
              <el-radio-group v-model="form.invoiceAddedTax">
                <el-radio :label="1">内含税</el-radio>
                <el-radio :label="2">外加税</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <div class="small_title">
              <div class="blur_point"></div>
              <span>纳税人信息</span>
            </div>
          </el-col>
          <el-col :span="12">
            <el-form-item label="纳税税务署" prop="taxsService">
              <el-input v-model="form.taxsService" placeholder="请输入纳税税务署" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="源泉税扣缴义务人名" prop="obligatoryName">
              <el-input v-model="form.obligatoryName" placeholder="请输入源泉税扣缴义务人名" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="法人号码" prop="corporateNumber">
              <el-input v-model="form.corporateNumber" placeholder="请输入法人号码" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="纳税人整理号码" prop="ttaxpayerNumber">
              <el-input v-model="form.ttaxpayerNumber" placeholder="请输入纳税人整理号码" />
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <div class="small_title">
              <div class="blur_point"></div>
              <span>其他</span>
            </div>
          </el-col>
          <el-col :span="12">
            <el-form-item label="独占代理店" prop="exclusiveAgency">
              <el-input v-model="form.exclusiveAgency" placeholder="请输入独占代理店" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="官网新书信息更新时间" prop="updateNewTime">
              <el-input v-model="form.updateNewTime" placeholder="请输入官网新书信息更新时间" />
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <div class="small_title">
              <div class="blur_point"></div>
              <span>备注</span>
            </div>
          </el-col>
          <el-col :span="24" style="font-weight: 700;font-size: 16px;margin-top: 10px">
            业务上注意点
          </el-col>
          <el-col :span="24">
            <el-form-item label="业务上注意点1" prop="businessNoticePoint1">
              <el-input v-model="form.businessNoticePoint1" :autosize="{minRows: 1}" type="textarea" :maxlength="200" placeholder="请输入内容" />
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="业务上注意点2" prop="businessNoticePoint2">
              <el-input v-model="form.businessNoticePoint2" :autosize="{minRows: 1}" type="textarea" :maxlength="200" placeholder="请输入内容" />
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="业务上注意点3" prop="businessNoticePoint3">
              <el-input v-model="form.businessNoticePoint3" :autosize="{minRows: 1}" type="textarea" :maxlength="200" placeholder="请输入内容" />
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="业务上注意点4" prop="businessNoticePoint4">
              <el-input v-model="form.businessNoticePoint4" :autosize="{minRows: 1}" type="textarea" :maxlength="200" placeholder="请输入内容" />
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="业务上注意点5" prop="businessNoticePoint5">
              <el-input v-model="form.businessNoticePoint5" :autosize="{minRows: 1}" type="textarea" :maxlength="200" placeholder="请输入内容" />
            </el-form-item>
          </el-col>
          <el-col :span="24" style="font-weight: 700;font-size: 16px;margin-top: 10px">
            合同上注意点
          </el-col>
          <el-col :span="24">
            <el-form-item label="合同上注意点1" prop="contractNoticePoint1">
              <el-input v-model="form.contractNoticePoint1" :autosize="{minRows: 1}" type="textarea" :maxlength="200" placeholder="请输入内容" />
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="合同上注意点2" prop="contractNoticePoint2">
              <el-input v-model="form.contractNoticePoint2" :autosize="{minRows: 1}" type="textarea" :maxlength="200" placeholder="请输入内容" />
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="合同上注意点3" prop="contractNoticePoint3">
              <el-input v-model="form.contractNoticePoint3" :autosize="{minRows: 1}" type="textarea" :maxlength="200" placeholder="请输入内容" />
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="合同上注意点4" prop="contractNoticePoint4">
              <el-input v-model="form.contractNoticePoint4" :autosize="{minRows: 1}" type="textarea" :maxlength="200" placeholder="请输入内容" />
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="合同上注意点5" prop="contractNoticePoint5">
              <el-input v-model="form.contractNoticePoint5" :autosize="{minRows: 1}" type="textarea" :maxlength="200" placeholder="请输入内容" />
            </el-form-item>
          </el-col>
          <el-col :span="24" style="font-weight: 700;font-size: 16px;margin-top: 10px">
            付款上注意点
          </el-col>
          <el-col :span="24">
            <el-form-item label="付款上注意点1" prop="payNoticePoint1">
              <el-input v-model="form.payNoticePoint1" :autosize="{minRows: 1}" type="textarea" :maxlength="200" placeholder="请输入内容" />
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="付款上注意点2" prop="payNoticePoint2">
              <el-input v-model="form.payNoticePoint2" :autosize="{minRows: 1}" type="textarea" :maxlength="200" placeholder="请输入内容" />
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="付款上注意点3" prop="payNoticePoint3">
              <el-input v-model="form.payNoticePoint3" :autosize="{minRows: 1}" type="textarea" :maxlength="200" placeholder="请输入内容" />
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="付款上注意点4" prop="payNoticePoint4">
              <el-input v-model="form.payNoticePoint4" :autosize="{minRows: 1}" type="textarea" :maxlength="200" placeholder="请输入内容" />
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="付款上注意点5" prop="payNoticePoint5">
              <el-input v-model="form.payNoticePoint5" :autosize="{minRows: 1}" type="textarea" :maxlength="200" placeholder="请输入内容" />
            </el-form-item>
          </el-col>
          <el-col :span="24" style="font-weight: 700;font-size: 16px;margin-top: 10px">
            其他注意点
          </el-col>
          <el-col :span="24">
            <el-form-item label="其他注意点1" prop="otherPoint1">
              <el-input v-model="form.otherPoint1" :autosize="{minRows: 1}" type="textarea" :maxlength="200" placeholder="请输入内容" />
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="其他注意点2" prop="otherPoint2">
              <el-input v-model="form.otherPoint2" :autosize="{minRows: 1}" type="textarea" :maxlength="200" placeholder="请输入内容" />
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="其他注意点3" prop="otherPoint3">
              <el-input v-model="form.otherPoint3" :autosize="{minRows: 1}" type="textarea" :maxlength="200" placeholder="请输入内容" />
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="其他注意点4" prop="otherPoint4">
              <el-input v-model="form.otherPoint4" :autosize="{minRows: 1}" type="textarea" :maxlength="200" placeholder="请输入内容" />
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="其他注意点5" prop="otherPoint5">
              <el-input v-model="form.otherPoint5" :autosize="{minRows: 1}" type="textarea" :maxlength="200" placeholder="请输入内容" />
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <div class="small_title">
              <div class="blur_point"></div>
              <span>公司概要</span>
            </div>
          </el-col>
          <el-col :span="12">
            <el-form-item label="公司成立日期" prop="companyCreatedTime">
              <el-date-picker clearable
                style="width: 100%"
                v-model="form.companyCreatedTime"
                type="date"
                value-format="yyyy-MM-dd"
                placeholder="请选择公司成立日期">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="资本额" prop="capitalAmount">
              <el-input v-model="form.capitalAmount" placeholder="请输入资本额" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="股东" prop="stockholder">
              <el-input v-model="form.stockholder" placeholder="请输入股东" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="年度营业额" prop="annualTurnover">
              <el-input v-model="form.annualTurnover" placeholder="请输入年度营业额" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="员工人数" prop="employeesNumber">
              <el-input v-model="form.employeesNumber" placeholder="请输入员工人数" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="经营项目" prop="businessProject">
              <el-input v-model="form.businessProject" placeholder="请输入经营项目" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="出版书种" prop="publishedBookType">
              <el-input v-model="form.publishedBookType" placeholder="请输入出版书种" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="全年出版书种的数量" prop="yearPublishNumber">
              <el-input v-model="form.yearPublishNumber" placeholder="请输入全年出版书种的数量" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="累计出版书种的数量" prop="allPublishNumber">
              <el-input v-model="form.allPublishNumber" placeholder="请输入累计出版书种的数量" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="原创作品和翻译作品之比例" prop="rawTranslateScale">
              <el-input v-model="form.rawTranslateScale" placeholder="请输入原创作品和翻译作品之比例" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="来往版权代理公司名" prop="copyrightAgencyName">
              <el-input v-model="form.copyrightAgencyName" placeholder="请输入来往版权代理公司名" />
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="公司特长，擅长书种，书系介绍" prop="conpanyIntroduce" label-width="220px">
              <el-input v-model="form.conpanyIntroduce" type="textarea" placeholder="请输入内容" />
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="各种催促开关" prop="urgeSwitch">
              <el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange">全选</el-checkbox>
              <el-checkbox-group v-model="form.urgeSwitch" placeholder="请选择发行者" @change="variousUrgeSwitchChange">
                <el-checkbox v-for="(i, index) in variousUrgeSwitchList" :key="index" :label="i"></el-checkbox>
              </el-checkbox-group>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listObligee, getObligee, delObligee, addObligee, updateObligee } from "@/api/system/obligee";

export default {
  name: "Obligee",
  data() {
    return {
      isIndeterminate: true,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 权利人表格数据
      obligeeList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        obligeeId: null,
        obligeeType: null,
        obligeeNameContractLocal: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        isRightHolder: [
          { required: true, message: "直往权利人，1：是，0：否不能为空", trigger: "blur" }
        ],
        // obligeeId: [
        //   { required: true, message: "权利人编号不能为空", trigger: "blur" }
        // ],
        obligeeType: [
          { required: true, message: "权利人类型不能为空", trigger: "blur" }
        ],
        review: [
          { required: true, message: "送审是否附上封面翻译，1：是，0：否不能为空", trigger: "blur" }
        ],
        addressLocal: [
          { required: true, message: "地址(当地语言)不能为空", trigger: "blur" }
        ],
        obligeeNameContractLocal: [
          { required: true, message: "合同上的权利人名称(当地语言)不能为空", trigger: "blur" }
        ],
        addressContractLocal: [
          { required: true, message: "合同上地址(当地语言)不能为空", trigger: "blur" }
        ],
        signatoryNameChinese: [
          { required: true, message: "签字代表(中文)不能为空", trigger: "blur" }
        ],
      },
      yesOrNot: [
        {
          value: 1,
          label: '是'
        },
        {
          value: 0,
          label: '否'
        },
      ],
      frequentAgencyShopList: [],
      obligeeTypeList: [
        {
          value: 1,
          label: '童书'
        },
        {
          value: 2,
          label: '成人'
        },
        {
          value: 3,
          label: '综合'
        },
      ],
      toTypeList: [
        {
          value: 1,
          label: '签约代表人'
        },
        {
          value: 2,
          label: '窗口'
        }
      ],
      ccTypeList: [
        {
          value: 1,
          label: '签约代表人'
        },
        {
          value: 2,
          label: '窗口'
        },
        {
          value: 3,
          label: '无'
        },
      ],
      monetaryUnitList: [
        {
          value: 1,
          label: 'JPY'
        },
        {
          value: 2,
          label: 'USD'
        },
        {
          value: 3,
          label: 'CNY'
        },
        {
          value: 4,
          label: 'TWD'
        },
      ],
      variousUrgeSwitchList: [
        '提醒报价截止日',
        '提醒付款',
        '催促未付款',
        '提醒出版/送审',
        '有送审日，无通过日，提醒工作人员',
        '送审中，已过出版期限，需要催促出版社',
        '过出版期限还未出版，且无送审',
        '未过出版期限，未提供赠书',
        '已过出版期限，未提供赠书',
        '已出版，催促赠书',
        '加印后，未提供赠书',
        '提醒提供版税报告',
        '催促未提供版税报告',
        '提醒提供合同草案',
        '催促合同未寄出',
        '提醒Offer未回复',
        '催促制作档案未提供',
        '催促工作样书未提供',
        '催促作者授权书',
        '催促完税证明',
        '提醒快到合同终止日是否续约或解约',
        '年初问候'
      ],
      checkAll: false
    };
  },
  created() {
    this.getList();
  },
  methods: {
    // 全选反选
    handleCheckAllChange(val) {
      this.form.urgeSwitch = val ? this.variousUrgeSwitchList : [];
      this.isIndeterminate = false;
    },
    variousUrgeSwitchChange (value) {
      let checkedCount = value.length;
      this.checkAll = checkedCount === this.variousUrgeSwitchList.length;
      this.isIndeterminate = checkedCount > 0 && checkedCount < this.variousUrgeSwitchList.length;
    },
    // 完税证明
    dutyPaidProofChange (val) {
      console.log('val-->', val);
      if (val === 1) {
        if (!this.form.urgeSwitch.includes('催促完税证明')) {
          this.form.urgeSwitch.push('催促完税证明')
        }
      } else {
        let num = this.form.urgeSwitch.indexOf('催促完税证明')
        if (num > -1) {
          this.form.urgeSwitch.splice(num, 1)
        }
      }
    },
    /** 查询权利人列表 */
    getList() {
      this.loading = true;
      listObligee(this.queryParams).then(response => {
        this.obligeeList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        isRightHolder: null,
        frequentAgencyShop: null,
        obligeeId: null,
        obligeeType: null,
        review: null,
        addressLocal: null,
        addressEng: null,
        obligeeNameContractLocal: null,
        obligeeNameContractEng: null,
        addressContractLocal: null,
        addressContractEng: null,
        companyPersonChinese: null,
        companyPersonEng: null,
        signatoryNameChinese: null,
        signatoryNameEng: null,
        signatoryPositionChinese: null,
        signatoryPositionEng: null,
        companyPhone: null,
        companyFax: null,
        companyEmail: null,
        companyOfficialWebsite: null,
        signWay: [],
        publisher: [],
        contractTyoeOnline: [],
        bankNameLocal: null,
        bankNameEng: null,
        bankAddressLocal: null,
        bankAddressEng: null,
        bankAccountNameLocal: null,
        bankAccountNameEng: null,
        bankAccountNumber: null,
        swiftCode: null,
        bankServiceCharge: 0,
        dutyPaidProof: 0,
        invoiceCompanyName: null,
        invoiceNumber: null,
        invoicePhone: null,
        bankDeposit: null,
        invoiceTime: 2,
        invoiceType: 1,
        invoiceAddedTax: null,
        taxsService: null,
        obligatoryName: null,
        corporateNumber: null,
        ttaxpayerNumber: null,
        exclusiveAgency: null,
        updateNewTime: null,
        businessNoticePoint: null,
        contractNoticePoint: null,
        payNoticePoint: null,
        companyCreatedTime: null,
        annualTurnover: null,
        publishedBookType: null,
        rawTranslateScale: null,
        capitalAmount: null,
        employeesNumber: null,
        yearPublishNumber: null,
        stockholder: null,
        operatingItems: null,
        allPublishNumber: null,
        conpanyIntroduce: null,
        remindDeadline: null,
        urgeSwitch: [],
        remindPay: null,
        urgePay: null,
        remindPublic: null,
        remindStaff: null,
        remindPublishHouse: null,
        notExamine: null,
        notPresentationBook: null,
        notPresentationBookOutDeadline: null,
        urgePresentationBook: null,
        overprintNotPresentationBook: null,
        remindRoyaltyReport: null,
        urgeNotRoyaltyReport: null,
        remindDraftContract: null,
        remindNotReturnContract: null,
        remindRecoverOffer: null,
        urgeOfferData: null,
        urgeNotOfferBook: null,
        urgeAuthorAccredit: null,
        urgeDutyPaidProof: null,
        remindIsRenewalOrRescind: null,
        newYearGreetings: null,
        chargePersonCauseList: [
          {
            section: "",
            chargePersonName: "",
            chargePersonName2: '',
            email2: '',
            email: "",
            phone: "",
            mobilePhone: "",
            sns: "",
            type: 1,
            toolType: 1,
          },
          {
            section: "",
            chargePersonName: "",
            chargePersonName2: '',
            email2: '',
            email: "",
            phone: "",
            mobilePhone: "",
            sns: "",
            type: 1,
            toolType: 1,
          },
          {
            section: "",
            chargePersonName: "",
            chargePersonName2: '',
            email2: '',
            email: "",
            phone: "",
            mobilePhone: "",
            sns: "",
            type: 1,
            toolType: 1,
          },
          {
            section: "",
            chargePersonName: "",
            chargePersonName2: '',
            email2: '',
            email: "",
            phone: "",
            mobilePhone: "",
            sns: "",
            type: 1,
            toolType: 1,
          },
        ],
        chargePersonAccountantList: [
          {
            section: "",
            chargePersonName: "",
            email: "",
            phone: "",
            mobilePhone: "",
            sns: "",
            type: 0,
            toolType: 1,
          },
          {
            section: "",
            chargePersonName: "",
            email: "",
            phone: "",
            mobilePhone: "",
            sns: "",
            type: 0,
            toolType: 1,
          },
          {
            section: "",
            chargePersonName: "",
            email: "",
            phone: "",
            mobilePhone: "",
            sns: "",
            type: 0,
            toolType: 1,
          }
        ],
        obligeeNameLocal: null,
        obligeeNameEng: null,
        addressLocal2: null,
        addressEng2: null,
        signatoryNameChinese2: null,
        signatoryNameEng2: null,
        signatoryNameChinese3: null,
        signatoryNameEng3: null,
        bankBranchNameLocal: null,
        bankBranchNameEng: null,
        businessProject: null,
        copyrightAgencyName: null,
        businessNoticePoint1: null,
        businessNoticePoint2: null,
        businessNoticePoint3: null,
        businessNoticePoint4: null,
        businessNoticePoint5: null,
        contractNoticePoint1: null,
        contractNoticePoint2: null,
        contractNoticePoint3: null,
        contractNoticePoint4: null,
        contractNoticePoint5: null,
        payNoticePoint1: null,
        payNoticePoint2: null,
        payNoticePoint3: null,
        payNoticePoint4: null,
        payNoticePoint5: null,
        otherPoint1: null,
        otherPoint2: null,
        otherPoint3: null,
        otherPoint4: null,
        otherPoint5: null,

      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加权利人";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getObligee(id, 1).then(response => {
        this.form = response.data;
        this.form.urgeSwitch = JSON.parse(this.form.urgeSwitch)
        this.form.signWay = this.form.signWay.split(',')
        this.form.publisher = this.form.publisher.split(',')
        this.form.contractTyoeOnline = this.form.contractTyoeOnline.split(',')
        this.open = true;
        this.title = "修改权利人";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          let form = JSON.parse(JSON.stringify(this.form))
          form.urgeSwitch = JSON.stringify(form.urgeSwitch)
          form.signWay = form.signWay.join(',')
          form.publisher = form.publisher.join(',')
          form.contractTyoeOnline = form.contractTyoeOnline.join(',')
          if (this.form.id != null) {
            updateObligee(form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addObligee(form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除权利人编号为"' + ids + '"的数据项？').then(function() {
        return delObligee(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('system/obligee/export', {
        ...this.queryParams
      }, `obligee_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
<style scoped>
.small_title {
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
}
.blur_point {
  width: 10px;
  height: 10px;
  background-color: #1890ff;
  border-radius: 10px;
  margin-right: 5px;
  
}
</style>
